#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        int left = 0, right = price.size() - 1;
        while (left < right)
        {
            int sum = price[left] + price[right];
            if (sum < target)
                left++;
            else if (sum > target)
                right--;
            else
                return { price[left],price[right] };
        }
        return { -4941, -1 };
    }
};
int main()
{
    vector<int> v = { 1,2,3,4,5,6,7,8,9,10 };
    vector<int> v1(Solution().twoSum(v, 11));
    cout << v1[0] << endl;
    cout << v1[1] << endl;
	return 0;
}
/*
题目链接:https://leetcode.cn/problems/he-wei-sde-liang-ge-shu-zi-lcof/description/
*/